<template>
    <div>
        <el-button @click="onedata()">one</el-button>
        <el-button @click="twodata()">two</el-button>
        <One v-if="asd==true" :data="data" />
        <Two v-else/>
    </div>
</template>
<script>
    import One from '@/components/one.vue'
    import Two from '@/components/two.vue'
    import {apiList} from '@/config/api/getData'
export default {
    components:{
        One,Two
    },
    data(){
        return{
            asd:true,
            data:[],
        }
    },
    mounted(){
        apiList().then(res=>{ 
            console.log(res,"结果");
            this.data = res.data.data;
        })
    },
    methods:{
        onedata(){
            this.asd = true;
        },
        twodata(){
            this.asd = false;
        },
    }
}
</script>
<style lang="sass" scoped>

</style>